/*
 * Created by 岱青海蓝信息系统(北京)有限公司 on 17-6-21 下午4:50
 * Copyright (c) 2017. All rights reserved.
 */

package com.example.dqhl.jdmetro.activities;

import android.os.Bundle;
import android.os.CountDownTimer;

import com.example.dqhl.jdmetro.MainActivity;
import com.example.dqhl.jdmetro.R;
import com.example.dqhl.jdmetro.base.BaseActivity;
import com.example.dqhl.jdmetro.utils.JumpItent;
/**
*description:闪屏页面
*autour:guanluocang
*date:17/6/23 09:54
*/
public class SplashActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        countDownTimer.start();
    }

    @Override
    public void initData() {

    }

    @Override
    public void initListener() {

    }

    /**
     * 第一秒的倒计时有时候不可见,所以将倒计时总时间设置为4s.
     *
     *  要Cancel掉
     * */
    private CountDownTimer countDownTimer = new CountDownTimer(4000,1000) {
        @Override
        public void onTick(long millisUntilFinished) {

        }

        @Override
        public void onFinish() {
            JumpItent.jump(SplashActivity.this, MainActivity.class);
            finish();
        }
    };

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(countDownTimer != null){
            countDownTimer.cancel();
        }
    }
}
